import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import installElementPlus from './plugins/element'
import axios from 'axios'
import zh_tran from './plugins/lang'
import set_font from './plugins/setfont'
import './assets/icon-font/iconfont'
import 'viewerjs/dist/viewer.css'
import VueViewer from 'v-viewer'

const app = createApp(App)
installElementPlus(app)

// 判断是否是开发环境
let ifDEV = process.env.NODE_ENV === "development"
const baseURL = ifDEV ? 'http://localhost:3000' : ''

axios.defaults.baseURL = baseURL
axios.defaults.withCredentials = true // 设置axios携带cookie
app.config.globalProperties.$axios = axios  // 全局挂载axios
app.config.globalProperties.$DoubanAPI = ifDEV ? "http://localhost/DoubanBoard/Action.php":"http://120.24.252.69/DoubanBoard/Action.php"
app.config.globalProperties.$zh_tran = zh_tran
app.config.globalProperties.$setFont = set_font

app
  .use(store)
  .use(router)
  .use(VueViewer)
  .mixin({
    data(){
      return{
        baseURL
      }
    }
  })
  .mount('#app')